<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<%-- <%@taglib uri="spring.tld" prefix="spring"%> --%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html>
  <head>
    	<base href="<%=basePath%>">
    
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>教材激活</title>
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="keywords" content="">
		<link rel="shortcut icon" href="<%=basePath%>resources/images/favicon.ico" />
		<link href="resources/bootstrap/css/bootstrap-huan.css" rel="stylesheet">
		<link href="resources/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="resources/css/style.css" rel="stylesheet">
	  	<link href="resources/js/layui/css/layui.css" rel="stylesheet">
	  	<link href="resources/js/layui/css/layui.css" rel="stylesheet">
		<link href="resources/css/exam.css" rel="stylesheet">
		<link href="resources/chart/morris.css" rel="stylesheet">
		<style>
			.table-striped a{
				text-decoration: underline;
			}
			
			.span-success{
				color:#5cb85c;
				font-weight:bolder;
			}
			
			.span-danger{
				color:#d9534f;
				font-weight:bolder;
			}
			
			.span-info{
				color:#5bc0de;
				font-weight:bolder;
			}
			h6{
				font-weight:bold !important; 
			}
			.activation-filter dl {
				margin-left: 90px;
				line-height: 28px;
				min-height: 28px;
			}

			.activation-filter dt {
				float: left;
				width: 80px;
				line-height: 30px;
				text-align: right;
				margin-left: -90px;
				/* font-weight: bold; */
				color: rgb(100,100,100);
			}

			.activation-filter{
				margin-top:20px;
			}

			.activation-filter dl span:hover{
				cursor:pointer;
				color:#ff7f74;

			}

			.activation-filter dl span{
				margin:0  8px 10px 0;
				display:inline-block;
				line-height: 30px;
			}
			.activation-filter dl span.active{
				line-height: 30px;
				background-color: #0088cc;
				padding: 0 15px;
				color: #fff;
			}
		</style>
	</head>
	<body>
		<header>
			<div class="container">
				<div class="row">
					<div class="col-xs-5">
						<div class="logo">
							<h1><a href="#">学测练管理平台</a></h1>
							<div class="hmeta">
								专注互联网在线考试解决方案
							</div>
						</div>
					</div>
					<div class="col-xs-7" id="login-info">
						<c:choose>
							<c:when test="${not empty sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}">
								<div id="login-info-user" class="hmeta">
									
									<a href="user-detail/${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}" id="system-info-account" target="_blank">${sessionScope.SPRING_SECURITY_CONTEXT.authentication.principal.username}</a>
									<span>|</span>
									<a href="j_spring_security_logout"><i class="fa fa-sign-out"></i> 退出</a>
								</div>
							</c:when>
							<c:otherwise>
								<a class="btn btn-primary" href="user-register">用户注册</a>
								<a class="btn btn-success" href="user-login-page">登录</a>
							</c:otherwise>
						</c:choose>
					</div>
				</div>
			</div>
		</header>
		<!-- Navigation bar starts -->

		<div class="navbar bs-docs-nav" role="banner">
			<div class="container">
				<nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
					<ul class="nav navbar-nav">
						<li>
							<a href="home" style="display:none"><i class="fa fa-home"></i>主页</a>
						</li>
						<li>
							<a href="start-exam"><i class="fa fa-edit"></i>试题练习</a>
						</li>
						<li class="active">
							<a href="student/usercenter"><i class="fa fa-dashboard"></i>个人中心</a>
						</li>
						<li>
							<a href="student/setting"><i class="fa fa-cogs"></i>个人设置</a>
						</li>
					</ul>
				</nav>
			</div>
		</div>

		<!-- Navigation bar ends -->

		<!-- Slider starts -->

		<div>
			<!-- Slider (Flex Slider) -->

			<div class="container" style="min-height:500px;">

				<div class="row">
					<div class="col-xs-3">
						<ul class="nav default-sidenav">
							<li>
								<a href="student/usercenter"> <i class="fa fa-dashboard"></i> 用户中心 </a>
							</li>
							<li>
								<a> <i class="fa fa-bar-chart-o"></i> 统计分析 </a>
							</li>
							<li>
								<a href="student/exam-history"> <i class="fa fa-history"></i> 考试历史 </a>
							</li>
							<li  class="active">
								<a href="student/activation"> <i class="fa fa-history"></i> 教材激活 </a>
							</li>
						</ul>
					</div>
					<div class="col-xs-9">

						<div class="page-header">
							<h1><i class="fa fa-list-ul"></i> 教材激活 </h1>
						</div>
						<div class="page-content row">
							<div class="activation-filter">
								<dl>
									<dt>
										激活方式：
									</dt>
									<dd>
										<c:forEach items="${typeList}" var="type">
											<c:choose>
												<c:when test="${questionFilter.fieldId == type.typeId }">
													<span class="label label-info" data-id="${type.typeId}">${type.typeName}</span>
												</c:when>
												<c:otherwise>
													<span class="active" data-id="${type.typeId}">${type.typeName}</span>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</dd>
									<div style="height: 20px"></div>
									<dt>
										序列号：
									</dt>
									<dd>
										<input id="serail_num" name="serail_num" size="30"/><button id="field_active_btn" style="margin-left: 10px;" class="btn btn-danger">激活</button>
									</dd>
								</dl>
							</div>
						</div>
						<div class="page-header">
							<h1><i class="fa fa-list-ul"></i> 可用教材 </h1>
						</div>
						<div class="page-content row">
							<div class="activation-filter">
								<dl>
									<dt>
										列表：
									</dt>
									<dd>
										<c:forEach items="${fieldList}" var="field">
											<c:choose>
												<c:when test="${questionFilter.fieldId == field.fieldId }">
													<span class="label label-info" data-id="${field.fieldId}">${field.fieldName}</span>
												</c:when>
												<c:otherwise>
													<span class="active" data-id="${field.fieldId}">${field.fieldName}</span>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</dd>
								</dl>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>

		<footer>
			<div class="container">
				<div class="row">
					<div class="col-md-12">
						<div class="copy" style="display:none">
							<p>
								粤教学练测平台 Copyright © <a href="http://www.examxx.net/" target="_blank">粤教学练测平台</a> - <a href="." target="_blank">主页</a> | <a href="http://www.examxx.net/" target="_blank">关于我们</a> | <a href="http://www.examxx.net/" target="_blank">FAQ</a> | <a href="http://www.examxx.net/" target="_blank">联系我们</a>
							</p>
						</div>
					</div>
				</div>

			</div>
		</footer>

		<!-- Slider Ends -->

		<!-- Javascript files -->
		<!-- jQuery -->
		<script type="text/javascript" src="resources/js/jquery/jquery-1.9.0.min.js"></script>
		<!-- Bootstrap JS -->
		<script type="text/javascript" src="resources/bootstrap/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="${ctx}/resources/js/layui/layui.all.js"></script>
		<script>
			$(function () {
				$("#field_active_btn").click(function () {
				    var number = $('#serail_num').val();
				    $.get("/user-active?serialNumber="+number,function (data,status) {
                        if(data.result == 'success'){
                            layer.msg(data.messageInfo);
                            setTimeout(function () {
                                window.location.href = "/student/activation";
                            },2000);
                        }
                        else{
                            layer.alert(data.messageInfo)
                        }
                    });
                });
            })
		</script>
	</body>
</html>